home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume16 / narc < prev    next >
Encoding:
Internet Message Format  |  1989-01-17  |  45.6 KB

  1. Subject:  v16i089:  Archive net sources groups
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: Geoff Leach <laticorp!geoff>
  6. Posting-number: Volume 16, Issue 89
  7. Archive-name: narc
  8.  
  9.  
  10. Narc is a collection of tools to help you with your NetNews habit.
  11. They're intended to minimize the effort involved in saving and
  12. cataloging sources from the Net.  The posting consists of one C source
  13. and a number of C shell scripts.  The C program was developed under Sun OS,
  14. but contains nothing that would make a System V or Xenix port difficult.
  15. The C shell scripts are another matter, of course.
  16.  
  17. What you have here is tools to capture the postings as they arrive and
  18. organize them as they are completed.  The author spends a few minutes
  19. each day and gets everything he wants.
  20.  
  21. #! /bin/sh
  22. # This is a shell archive.  Remove anything before this line, then unpack
  23. # it by saving it into a file and typing "sh file".  To overwrite existing
  24. # files, type "sh file -c".  You can also feed this as standard input via
  25. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  26. # will see the following message at the end:
  27. #        "End of shell archive."
  28. # Contents:  README CheckManifest.1 MakeArchiveIndex.1 assemble.1
  29. #   narc.1 roffit.1 CheckManifest.csh MakeArchiveIndex.csh
  30. #   assemble.csh makemap.csh roffit.csh narc.c patchlevel.h version.h
  31. #   Makefile
  32. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  33. if test -f 'README' -a "${1}" != "-c" ; then 
  34.   echo shar: Will not clobber existing file \"'README'\"
  35. else
  36. echo shar: Extracting \"'README'\" \(2179 characters\)
  37. sed "s/^X//" >'README' <<'END_OF_FILE'
  38. X    Did you ever fail to capture a postings because it was too much hassle,
  39. X    only to wish you had done so a few months later?  Hopefully its now not
  40. X    so much of a problem.
  41. X
  42. X    This posting provides you with some relief for your NetNews habit.  In
  43. X    particular, it helps you with the capture and organization of your
  44. X    archive of NetNews source postings.  The posting consists of a single C
  45. X    program and a few Csh scripts.  The program was developed under Sun OS
  46. X    3.4 (i.e., BSD) but should not be too difficult to port to Xenix or
  47. X    System V. The Csh scripts may be another matter.  Perhaps a Perl port?
  48. X
  49. X    What you have here is tools to capture the postings as they arrive and
  50. X    organize them as they are completed.  The author spends a few minutes
  51. X    each day and gets everything he wants.
  52. X
  53. X    Aliases and a configuration file, .narcrc, are part of the total system.
  54. X    Here are the ones that the author finds useful.
  55. X
  56. X        alias ton    'pushd $ARCHIVE/$ARCDIR/$ARCVOL'
  57. X        alias arc    'setenv ARCDIR \!*'
  58. X        alias vol    'setenv ARCVOL v\!*'
  59. X        alias text    'setenv ARCDIR text; setenv ARCVOL '
  60. X        alias alt    'setenv ARCDIR alt; setenv ARCVOL '
  61. X        alias doc    'setenv ARCDIR doc; setenv ARCVOL '
  62. X        alias unix    'setenv ARCDIR unix; setenv ARCVOL v16'
  63. X        alias misc    'setenv ARCDIR misc; setenv ARCVOL v04'
  64. X        alias games    'setenv ARCDIR games; setenv ARCVOL v05'
  65. X        alias x        'setenv ARCDIR x; setenv ARCVOL v01'
  66. X
  67. X    and from his .narcrc file
  68. X
  69. X        comp.sources.unix:unix:Posting-number
  70. X        comp.sources.misc:misc:Posting-number
  71. X        comp.sources.games:games:Comp.sources.games
  72. X        comp.sources.x:x:Posting-number
  73. X        alt.sources:alt
  74. X        comp.doc:doc
  75. X        comp.text:text
  76. X
  77. X    Suggestions and bug reports are welcome.  I'd particularly like to 
  78. X    hear from Xenix and System V users who might wish to contribute diffs
  79. X    for their particular environments.  Or a /bin/sh port of the scripts.
  80. X    Whatever.
  81. X
  82. X    I've also included makemap.csh.  I spent some time figuring out a 
  83. X    way to make use of the UseNet maps in a way that (a) did not require
  84. X    a bunch of repeat processing and (b) did not require the deletion
  85. X    of the posting after processing.  This is my solution.  
  86. X
  87. X    Enjoy!
  88. X
  89. X    Geoffrey Leach    
  90. X    {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  91. END_OF_FILE
  92. if test 2179 -ne `wc -c <'README'`; then
  93.     echo shar: \"'README'\" unpacked with wrong size!
  94. fi
  95. # end of 'README'
  96. fi
  97. if test -f 'CheckManifest.1' -a "${1}" != "-c" ; then 
  98.   echo shar: Will not clobber existing file \"'CheckManifest.1'\"
  99. else
  100. echo shar: Extracting \"'CheckManifest.1'\" \(978 characters\)
  101. sed "s/^X//" >'CheckManifest.1' <<'END_OF_FILE'
  102. X.TH CHECKMANIFEST 1 "7 October 1988"
  103. X.SH NAME
  104. XCheckManifest \- Check the manifest from a posting against the delivered files.
  105. X.sp
  106. X.SH SYNOPSIS
  107. X.B CheckManifest [
  108. X.I manifest-file
  109. X.B ]
  110. X.sp
  111. X.SH DESCRIPTION
  112. X.I CheckManifest
  113. Xis a C\-shell script that checks the files in the current directory
  114. Xagainst a manifest.  The manifest is sought in files named
  115. X.I MANIFEST
  116. Xor
  117. X.I Manifest.
  118. XOptionally, the 
  119. X.I manifest-file
  120. Xmay be specified on the command line.
  121. X.sp
  122. X.SH OPTIONS
  123. X.IP "manifest-file" .5i
  124. XOverrides default file name.
  125. X.sp
  126. X.SH DIAGNOSTICS
  127. X.I file-name
  128. Xnot delivered.
  129. X.sp
  130. X.SH FILES
  131. X.IP "MANIFEST" .5i
  132. XDefault name for manifest file.
  133. X.IP "Manifest" .5i
  134. XAnother default name for manifest file.
  135. X.sp
  136. X.SH BUGS
  137. XThe manifest file format is not standardized.  Confusion may result.
  138. XNot a Bourne shell script (sorry).
  139. XWould probably be better as a
  140. X.I perl
  141. Xscript.
  142. X.sp
  143. X.SH SEE ALSO
  144. Xassemble(1)
  145. X.sp
  146. X.SH AUTHOR
  147. X.PP
  148. XGeoffrey Leach 
  149. X.br
  150. X.I {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  151. END_OF_FILE
  152. if test 978 -ne `wc -c <'CheckManifest.1'`; then
  153.     echo shar: \"'CheckManifest.1'\" unpacked with wrong size!
  154. fi
  155. # end of 'CheckManifest.1'
  156. fi
  157. if test -f 'MakeArchiveIndex.1' -a "${1}" != "-c" ; then 
  158.   echo shar: Will not clobber existing file \"'MakeArchiveIndex.1'\"
  159. else
  160. echo shar: Extracting \"'MakeArchiveIndex.1'\" \(796 characters\)
  161. sed "s/^X//" >'MakeArchiveIndex.1' <<'END_OF_FILE'
  162. X.TH MAKEARCHIVEINDEX 1 "7 October 1988"
  163. X.SH NAME
  164. XMakeArchiveIndex \- Gather individual indices into a sorted master file.
  165. X.sb
  166. XPrintArchiveIndex \- Print individual archive directories.
  167. X.sp
  168. X.SH SYNOPSIS
  169. X.B MakeArchiveIndex
  170. X.br
  171. X.B PrintArchiveIndex
  172. X.sp
  173. X.SH DESCRIPTION
  174. X.I MakeArchiveIndex
  175. Xis a C\-shell script that gathers together the 
  176. X.I Index
  177. Xfiles in the given list of directories formats and sorts them.
  178. X.sp
  179. X.I PrintArchiveIndex
  180. Xprints the directory listings of the directories in the archive.
  181. X.sp
  182. X.SH OPTIONS
  183. XNone.
  184. X.sp
  185. X.SH DIAGNOSTICS
  186. XNone.
  187. X.sp
  188. X.SH FILES
  189. X.IP "Index" .5i
  190. XCreated by the user in each archive directory.
  191. X.sp
  192. X.SH BUGS
  193. XNot a Bourne shell script (sorry).
  194. X.sp
  195. X.SH SEE ALSO
  196. Xassemble(1)
  197. X.sp
  198. X.SH AUTHOR
  199. X.PP
  200. XGeoffrey Leach 
  201. X.br
  202. X.I {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  203. END_OF_FILE
  204. if test 796 -ne `wc -c <'MakeArchiveIndex.1'`; then
  205.     echo shar: \"'MakeArchiveIndex.1'\" unpacked with wrong size!
  206. fi
  207. # end of 'MakeArchiveIndex.1'
  208. fi
  209. if test -f 'assemble.1' -a "${1}" != "-c" ; then 
  210.   echo shar: Will not clobber existing file \"'assemble.1'\"
  211. else
  212. echo shar: Extracting \"'assemble.1'\" \(6441 characters\)
  213. sed "s/^X//" >'assemble.1' <<'END_OF_FILE'
  214. X.TH ASSEMBLE 1 "7 October 1988"
  215. X.SH NAME
  216. Xassemble \- gather files that constitute a posting into a single directory
  217. X.br
  218. Xarchive \- move program directory into the appropriate place in an archive tree
  219. X.br
  220. Xretrieve \- put an expanded archive file in the current directory
  221. X.sp
  222. X.SH SYNOPSIS
  223. X.B assemble [\-a \fIarchive-directory \fB[\-v \fIarchive-volume\fB]]
  224. X[-s] [\-e \fIfile-name ...\fB]
  225. X.ti 1.0i
  226. X.br
  227. X.B \-n 
  228. X.I archive-name \ first-issue
  229. X.B [\fInumber-of-issues\fB]
  230. X.sp
  231. X.B archive [\-a \fIarchive-directory \fB[\-v \fIarchive-volume\fB]]
  232. X.I archive-name
  233. X.sp
  234. X.B retrieve [\-a \fIarchive-directory \fB[\-v \fIarchive-volume\fB]]
  235. X.I archive-name
  236. X.sp
  237. X.SH DESCRIPTION
  238. X.I Assemble
  239. Xis a C\-shell script that permits the assembly of a group of related 
  240. Xfiles (generally from UseNet newsgroup postings) into 
  241. X.I archive-name
  242. Xfor archiving.  Unshar (or tar) is applied to the files, which are then moved
  243. Xinto a subdirectory for later removal.  
  244. XIf 
  245. X.I uhshar 
  246. Xproduces a 
  247. X.I .hdr
  248. Xheader file, it is moved into 
  249. X.I HDRS;
  250. Xsaving headers can be helpful in identifying the source
  251. Xof the posting at a later date.  The names of the files themselves
  252. Xare saved in 
  253. X.I FILES
  254. Xand will be deleted by 
  255. X.I assemble.
  256. XIf a manifest is posted, it will be checked.  If files with
  257. Xan appropriate extension (.man, .nro, .[1-8]) are found within the directory,
  258. X.I nroff \-man
  259. Xwill be applied to each, the result being stored in a subdirectory
  260. Xunder 
  261. X.I manl
  262. Xwithin the archive.
  263. X.sp
  264. XThe files to be
  265. X.I assembled
  266. Xmay be specified either as a starting issue number (with optional number
  267. Xof issues) or (with the 
  268. X.B \-e
  269. Xoption), a file name.
  270. XIn the former case, the name of the file to be retrieved is implied
  271. Xfrom the name of the 
  272. X.B ARCVOL 
  273. Xdirectory.  For instance, if we are 
  274. Xdealing with comp.sources.unix volume 16, we will be 
  275. X.I assembling
  276. Xfiles whose name is of the form 
  277. X.I v16innn.
  278. XAssuming that the archive has been set up with 
  279. X.B ARCDIR
  280. Xset to "unix"
  281. X.B ARCVOL 
  282. Xset to "16",
  283. X.I assemble \-n example 23 4
  284. Xwill assemble 
  285. X.Iv16i023, v16i024, v16i025 
  286. Xand 
  287. X.I v16i026
  288. Xfrom 
  289. X.I unix/v16
  290. Xrelative to the base directory specified by
  291. X.B ARCHIVE
  292. Xinto the directory 
  293. X.I example
  294. X.sp
  295. X.I Archive
  296. Xis a C\-shell script that permits an 
  297. X.I assembled
  298. Xset of files to be archived in the user's archive hierarchy.
  299. XThe directory specified by
  300. X.I archive-name
  301. Xis saved as a compressed tar file.
  302. XIf 
  303. X.I archive-name.tar.Z
  304. Xexists, it is silently replaced by the new file.
  305. XWithin the 
  306. X.I archive-name
  307. Xdirectory, the directory 
  308. X.I ARCF 
  309. Xis removed and the files specified by 
  310. X.I FILES
  311. Xare deleted.
  312. X.sp
  313. X.I Retrieve
  314. Xis a C\-shell script that permits an
  315. X.I archived
  316. Xdirectory to be copied form the archive hierarchy and restored in
  317. Xconventional form in the current directory.
  318. XThe archive file is untouched.
  319. X.sp
  320. X.SH OPTIONS
  321. X.IP "\-a archive-directory" .5i
  322. XThe archive directory.  This directory (which must already exist)
  323. Xis on the first level below the archive base, which is specified by the
  324. Xenvironment variable 
  325. X.B ARCHIVE.  
  326. XThe specification for 
  327. X.B \-a
  328. Xoverrides the value of the environment variable 
  329. X.B ARCDIR.
  330. XIf
  331. X.B \-a
  332. Xis used,
  333. X.B \-v
  334. Xis required.
  335. X.sp
  336. X.IP "\-e" .5i
  337. XThe 
  338. X.I extract
  339. Xflag can be set to indicated that even though a directory
  340. Xis a moderated newsgroup, the file(s) are to be extracted
  341. Xby name rather than by number.
  342. XThis option is useful if you are re-organizing an existing directory.
  343. X.sp
  344. X.IP "\-n archive-name" .5i
  345. XThe name 
  346. Xgiven to the directory into which files are
  347. X.I assembled
  348. Xand from which an archive file is created by 
  349. X.I archive.
  350. XThe
  351. X.I archive-name
  352. Xgiven to
  353. X.I retrieve
  354. Ximplies
  355. X.I archive-name.tar.Z
  356. Xwithin the archive directory.
  357. X.sp
  358. X.IP "\-s" .5i
  359. XShort assemble.  "Just the files, ma'm."
  360. X.sp
  361. X.IP "\-v archive-volume" .5i
  362. XThe archive volume.  This directory (which must already exist)
  363. Xis on the second level of the archive, below 
  364. X.B ARCDIR.  
  365. XIt is useful for the management of moderated newsgroups.  
  366. X.B \-v
  367. Xoverrides the value of the environment variable 
  368. X.B ARCVOL.
  369. XIf
  370. X.B\-a
  371. Xis used,
  372. X.B\-v
  373. Xis required.
  374. X.sp
  375. X.SH ENVIRONMENT VARIABLES
  376. X.IP "ARCHIVE" .5i
  377. XSpecifies the path (full or relative, as appropriate) for the 
  378. Xdirectory in which the archives directories are maintained.
  379. X.B ARCHIVE 
  380. Xmust be defined, or an equivalent definition made in
  381. X.I assemble
  382. Xand
  383. X.I narc.
  384. X.sp
  385. X.IP "ARCDIR" .5i
  386. XSpecifies the volume used for archiving.
  387. XIf not defined, 
  388. X.B \-a
  389. Xmust be used with all commands.  Value is overridden by
  390. X.B \-a.
  391. X.sp
  392. X.IP "ARCVOL" .5i
  393. XSpecifies the volume used for archiving.  Relevant only if 
  394. X.B ARCDIR
  395. Xis a moderated newsgroup.  If not defined, 
  396. X.B \-v
  397. Xmust be used with all commands.  Value is overridden by
  398. X.B \-v.
  399. X.sp
  400. X.SH DIAGNOSTICS
  401. XPrompts are provided if 
  402. X.I archive-directory
  403. Xor
  404. X.I archive-name
  405. Xis missing where required.  
  406. X.sp
  407. X"File not found" is given if a file specified or implied by a command is not
  408. Xlocated, but the script will attempt to go on, especially if a range of files
  409. Xis implied.
  410. X.sp
  411. X.I CheckManifest
  412. Xand
  413. X.I roffit
  414. XAre called by
  415. X.I assemble.
  416. XThey have their own diagnostics.
  417. X.sp
  418. X.SH FILES
  419. X.IP "ARCF" .5i
  420. XSubdirectory created to hold the original files prior to deletion by
  421. X.I archive.
  422. X.sp
  423. X.IP "FILES" .5i
  424. XList of files used to create the archive.  Created by
  425. X.I assemble
  426. Xfor deletion by
  427. X.I archive.
  428. X.sp
  429. X.IP "HDRS" .5i
  430. XA subdirectory created for the saving of the 
  431. X.I .hdr
  432. Xfile left behind by the action of (some)
  433. X.I unshar
  434. Xprograms.
  435. X.sp
  436. X.IP "manl" .5i
  437. XA subdirectory in the 
  438. X.B ARCHIVE
  439. Xdirectory where a subdirectory for
  440. X.I archive-name
  441. Xis created to hold formatted man pages.
  442. X.sp
  443. X.IP "PATCHES" .5i
  444. XA handy directory created for later collection of patches.
  445. X.sp
  446. X.bp
  447. X.SH EXAMPLE
  448. XHere is a sample archive directory:
  449. X.sp
  450. X.nf
  451. X/dbase/central/news/netsrc/x:
  452. Xv00    v01
  453. X
  454. X/dbase/central/news/netsrc/x/v00:
  455. XIndex        Indexr        awm.tar.Z    xwatch.tar.Z
  456. X
  457. X/dbase/central/news/netsrc/x/v01:
  458. XIndex        menupane.tar.Z    xfig.tar.Z    xmoire.tar.Z    xsecure.tar.Z
  459. XIndexr        qix.tar.Z        xipr.tar.Z    xphoon.tar.Z    xtools.tar.Z
  460. Xdclock.tar.Z    twm.tar.Z    xmille.tar.Z    xplaces.tar.Z
  461. X.fi
  462. X.sp
  463. X.SH BUGS
  464. XIndividual users will want to modify to their tastes and needs.
  465. XThe author is continually fiddling with them.
  466. X.I Assemble
  467. Xassumes you're using the version of 
  468. X.I shar
  469. Xposted by Rick $altz to comp.sources.unix.
  470. XNot a Bourne shell script (sorry).
  471. XWould probably be better as a
  472. X.I perl
  473. Xscript.
  474. X.sp
  475. X.SH SEE ALSO
  476. Xnarc(1), unshar(1), compress(1), tar(1), CheckManifest(1), roffit(1)
  477. X.sp
  478. X.SH AUTHOR
  479. X.PP
  480. XGeoffrey Leach 
  481. X.br
  482. X.I {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  483. END_OF_FILE
  484. if test 6441 -ne `wc -c <'assemble.1'`; then
  485.     echo shar: \"'assemble.1'\" unpacked with wrong size!
  486. fi
  487. # end of 'assemble.1'
  488. fi
  489. if test -f 'narc.1' -a "${1}" != "-c" ; then 
  490.   echo shar: Will not clobber existing file \"'narc.1'\"
  491. else
  492. echo shar: Extracting \"'narc.1'\" \(4873 characters\)
  493. sed "s/^X//" >'narc.1' <<'END_OF_FILE'
  494. X.TH NARC 1 "1 September 1988"
  495. X.SH NAME
  496. Xnarc \- take files from a newsreader and place them in a place suitable
  497. Xfor
  498. X.I assemble(1).
  499. X.sp
  500. X.SH SYNOPSIS
  501. X.B narc 
  502. X.B [\-px] [\-a
  503. X.I archive-directory
  504. X.B [\-v 
  505. X.I archive-volume
  506. X.B ]] 
  507. X.sp
  508. X.SH DESCRIPTION
  509. X.I narc
  510. X(\fBN\fRetnews \fBARC\fRhive) takes a stream of articles from 
  511. X.I stdin
  512. Xand figures out where they go, based on the 
  513. X.I .narcrc 
  514. Xfile in the user's home directory. If 
  515. X.I .narcrc 
  516. Xdoes not mention the newsgroup, the user will be prompted, if s/he has
  517. Xnot specified a treatment with 
  518. X.B \-a.
  519. XThe first newsfile or 
  520. X.B \-a 
  521. Xsetting determines treatment for the entire run.
  522. X.sp
  523. XIf he newsgroup is moderated, a volume subdirectory and the file name
  524. Xwithin that directory are determined from the posting.  Otherwise,
  525. Xa three-digit name is given to the file, with numbering being
  526. Xsupplied by a file 
  527. X.I .names 
  528. Xwithin the archive directory.  This file is created by 
  529. X.I narc 
  530. Xas required.  It ensures unique naming for files being saved 
  531. X.I en bloc.
  532. X.sp
  533. X.SH OPTIONS
  534. XAn illegal option will produce a diagnostic and a usage message.
  535. X.IP "\-a archive-directory" .5i
  536. XThe archive directory.  This directory (which must already exist)
  537. Xis on the first level below the archive base, which is specified by the
  538. Xenvironment variable 
  539. X.B ARCHIVE.  
  540. XThe specification for 
  541. X.B \-a
  542. Xoverrides the value of the environment variable 
  543. X.B ARCDIR.
  544. X.sp
  545. X.IP "\-p" .5i
  546. XThe 
  547. X.I prompt
  548. Xflag will cause the user to be prompted for an archive volume and for
  549. Xthe name of each of the files into which the articles are to be saved.
  550. X.sp
  551. X.IP "\-v archive-volume" .5i
  552. XThe archive volume.  This directory (which must already exist)
  553. Xis on the second level of the archive, below 
  554. X.B ARCDIR.  
  555. XIt is useful for the management of moderated newsgroups.  
  556. X.B \-v
  557. Xoverrides the value of the environment variable 
  558. X.B ARCVOL.
  559. X.sp
  560. X.IP "\-x" .5i
  561. XDebugging.  
  562. X.I Narc
  563. Xwill tell you what its going to do, but then do it in the 
  564. X.I cwd 
  565. Xinstead.
  566. X.sp
  567. X.SH ENVIRONMENT VARIABLES
  568. X.IP "ARCHIVE" .5i
  569. XSpecifies the path for the 
  570. Xdirectory in which the archives directories are maintained.
  571. X.B ARCHIVE 
  572. Xmust be defined, or an equivalent definition made in
  573. X.I assemble
  574. Xand
  575. X.I narc.
  576. X.sp
  577. X.SH FILES
  578. X.IP "~/.narcrc" .5i
  579. XColon-separated fields that describe what to do for standard newsgroups.
  580. XIn the format:
  581. X.sp
  582. X.ta 1i 2i
  583. X    newsgroup:archive-directory[:volume-tag]
  584. X.sp
  585. Xwhere the interpretation of the colon-separated fields is as follows.
  586. X.sp
  587. X.in 1i
  588. X.ip "newsgroup"
  589. XThe 
  590. X.I first
  591. Xname to be found on the "Newsgroups: " line in the article header.
  592. X.ip "archive-directory"
  593. XThe directory associated with this newsgroup.
  594. X.ip "volume-tag"
  595. XThe beginning of the line in the archive header
  596. Xthat flags the line that specifies the volume in a moderated newsgroup.
  597. XIf this entry is empty, an un-moderated newsgroup is implied.
  598. X.sp
  599. XThe \fI.narcrc\fR entry for
  600. X.I comp.sources.unix
  601. Xis:
  602. X.sp
  603. X    comp.sources.unix:unix:Posting-number
  604. X.sp
  605. XThis is because the header for postings to this newsgroup has the entries
  606. X.sp
  607. X    Newsgroups: comp.sources.unix
  608. X.br
  609. Xand
  610. X.br
  611. X    Posting-number: Volume 16, Issue 1
  612. X.sp
  613. XThe volume-tag field is needed because not all moderated newsgroups
  614. Xuse the same header to identify the current volume for the archive.  
  615. XOn the other hand, they all use the header
  616. X.sp
  617. X    Archive-name: <stuff>
  618. X.sp
  619. Xto identify the name of the archive entry.
  620. X.sp
  621. X.IP ".names" .5i
  622. XCreated in archive directory for un-moderated newsgroup to keep track of
  623. Xsaved articles.
  624. X.sp
  625. X.IP "Indexr" .5i
  626. XCreated in each archive directory to receive subject line (slightly modified)
  627. Xfor each article saved in that directory.  It's expected that the user
  628. Xwill extract one line for each group of related articles, clean it up
  629. Xand place it in the Index file in that directory.
  630. X.sp
  631. X.SH DIAGNOSTICS
  632. X.IP "<filename> exists! (a)ppend, (i)gnore or (r)eplace [r]? " 0.5i
  633. XYou've already saved a file by this name.  Its not a repost, because we handle 
  634. Xthat case.
  635. X.sp
  636. X.IP "Unable to rename %s" 0.5i
  637. XFailure from the rename system call.
  638. X.sp
  639. X.IP "Could not find newsgroup (or volume) within nnn lines" 0.5i
  640. X\fINarc\fR must read ahead in the input stream to find the headers.  Because
  641. Xinput may be from a pipe, it must buffer in order to re-process what's already 
  642. Xscanned.  You've just exceeded the size of the buffer!  
  643. XEither this the Newsgroup header is missing or your favorite moderator has
  644. Xpermitted an article to slip through without the volume-tag header.
  645. X.sp
  646. X.IP "Archive directory for %s? " 0.5i
  647. XThe article you are processing is not one of those listed in your 
  648. X\fI.narcrc\fR file.  You need to specify an archive directory.
  649. X.sp
  650. X.IP "Could not chdir to <directory>" 0.5i
  651. XSorry, \fIchdir\fR failed.
  652. X.sp
  653. X.IP "Error opening %s" 0.5i
  654. XGeneral-purpose error message, with interpreted system error to follow.
  655. X.sp
  656. X.SH SEE ALSO
  657. Xassemble(1)
  658. X.sp
  659. X.SH AUTHOR
  660. X.PP
  661. XGeoffrey Leach 
  662. X.br
  663. X.I {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  664. END_OF_FILE
  665. if test 4873 -ne `wc -c <'narc.1'`; then
  666.     echo shar: \"'narc.1'\" unpacked with wrong size!
  667. fi
  668. # end of 'narc.1'
  669. fi
  670. if test -f 'roffit.1' -a "${1}" != "-c" ; then 
  671.   echo shar: Will not clobber existing file \"'roffit.1'\"
  672. else
  673. echo shar: Extracting \"'roffit.1'\" \(1148 characters\)
  674. sed "s/^X//" >'roffit.1' <<'END_OF_FILE'
  675. X.TH ROFFIT 1 "7 October 1988"
  676. X.SH NAME
  677. Xroffit \- Look for files which might contain man page documentation and 
  678. Xformat them into the 
  679. X.I manl
  680. Xdirectory in the archive hierarchy.
  681. X.sp
  682. X.SH SYNOPSIS
  683. X.B roffit [
  684. X.I man-files
  685. X.B ]
  686. X.sp
  687. X.SH DESCRIPTION
  688. X.I Roffit
  689. Xis a C\-shell script which checks the files in the current directory tree
  690. Xfor files with extensions
  691. X.I l, man, nro and [1-8]
  692. Xand applies
  693. X.I nroff -man
  694. Xto each, directing the output to the
  695. X.I manl
  696. Xdirectory in the archive hierarchy.  If name conflicts arise, the user
  697. Xis prompted.
  698. X.sp
  699. X.SH OPTIONS
  700. X.IP "man-file" .5i
  701. XProcess these files instead of searching.
  702. X.sp
  703. X.SH ENVIRONMENT VARIABLES
  704. X.IP "ARCHIVE" .5i
  705. XThe location of the archive hierarchy.
  706. X.sp
  707. X.SH BUGS
  708. XNot a Bourne shell script (sorry).
  709. X.sp
  710. X.SH DIAGNOSTICS
  711. X.IP "Man page <file> exists.  (i)gnore, (o)verwrite or new name(n) [i]? " 0.5i
  712. XAll of the formatted man pages are placed in the same directory.
  713. XOften, a posting will include some useful items that are not
  714. Xuniversally available.  Getopt(3) often shows up.
  715. X.sp
  716. X.SH SEE ALSO
  717. Xassemble(1)
  718. X.sp
  719. X.SH AUTHOR
  720. X.PP
  721. XGeoffrey Leach 
  722. X.br
  723. X.I {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  724. END_OF_FILE
  725. if test 1148 -ne `wc -c <'roffit.1'`; then
  726.     echo shar: \"'roffit.1'\" unpacked with wrong size!
  727. fi
  728. # end of 'roffit.1'
  729. fi
  730. if test -f 'CheckManifest.csh' -a "${1}" != "-c" ; then 
  731.   echo shar: Will not clobber existing file \"'CheckManifest.csh'\"
  732. else
  733. echo shar: Extracting \"'CheckManifest.csh'\" \(520 characters\)
  734. sed "s/^X//" >'CheckManifest.csh' <<'END_OF_FILE'
  735. X#!    /bin/csh    -f
  736. X
  737. X# If there's a manifest here, check it against what's been delivered
  738. X
  739. X# Geoffrey Leach
  740. X# LatiCorp Inc.    
  741. X# {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  742. X
  743. Xif ( $#argv == 1 ) then
  744. X    set MANIFEST = $1
  745. Xelse
  746. X    if ( -e MANIFEST ) then
  747. X    set MANIFEST = "MANIFEST"
  748. X    else
  749. X    if ( -e Manifest ) set MANIFEST = "Manifest"
  750. X    endif
  751. Xendif
  752. Xif ( $?MANIFEST ) then
  753. X    echo Checking manifest
  754. X    foreach f ( `awk '{if ( NR > 2 ) print $1}' ${MANIFEST}` )
  755. X    if ( ! -e $f ) echo $f not delivered
  756. X    end
  757. Xendif
  758. END_OF_FILE
  759. if test 520 -ne `wc -c <'CheckManifest.csh'`; then
  760.     echo shar: \"'CheckManifest.csh'\" unpacked with wrong size!
  761. fi
  762. chmod +x 'CheckManifest.csh'
  763. # end of 'CheckManifest.csh'
  764. fi
  765. if test -f 'MakeArchiveIndex.csh' -a "${1}" != "-c" ; then 
  766.   echo shar: Will not clobber existing file \"'MakeArchiveIndex.csh'\"
  767. else
  768. echo shar: Extracting \"'MakeArchiveIndex.csh'\" \(1261 characters\)
  769. sed "s/^X//" >'MakeArchiveIndex.csh' <<'END_OF_FILE'
  770. X#!    /bin/csh    -f
  771. X
  772. X# Geoffrey Leach
  773. X# LatiCorp Inc.    
  774. X# {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  775. X
  776. Xset NAME = $0
  777. Xset NAME = $NAME:t
  778. X
  779. Xset LIST = ( \
  780. X    games/v00 \
  781. X    games/v01 \
  782. X    games/v02 \
  783. X    games/v03 \
  784. X    games/v04 \
  785. X    games/v05 \
  786. X    misc/v02 \
  787. X    misc/v03 \
  788. X    misc/v04 \
  789. X    misc/v05 \
  790. X    x/v00 \
  791. X    x/v01 \
  792. X    x/v02 \
  793. X    unix/v00 \
  794. X    unix/v01 \
  795. X    unix/v02 \
  796. X    unix/v03 \
  797. X    unix/v04 \
  798. X    unix/v05 \
  799. X    unix/v06 \
  800. X    unix/v07 \
  801. X    unix/v08 \
  802. X    unix/v09 \
  803. X    unix/v10 \
  804. X    unix/v11 \
  805. X    unix/v12 \
  806. X    unix/v13 \
  807. X    unix/v14 \
  808. X    unix/v15 \
  809. X    unix/v16 \
  810. X    benchmarks \
  811. X    graphics \
  812. X    patches \
  813. X    lang \
  814. X    util \
  815. X    text \
  816. X    gnu \
  817. X    doc \
  818. X    dos \
  819. X    lib \
  820. X    alt )
  821. X
  822. Xcd $ARCHIVE
  823. Xswitch ( $NAME )
  824. X    case MakeArchiveIndex:    
  825. X    if ( -e I ) rm I
  826. X    foreach f ( ${LIST} )
  827. X    awk -F: '{n = $1 " (" v "):"; \
  828. X        if ( substr($2, 1, 1) == "\t" ) $2 = substr($2, 2); \
  829. X        if ( substr($2, 1, 1) == "\t" ) $2 = substr($2, 2); \
  830. X        $2 = substr($2,1,46); \
  831. X        if ( length(n) <  8 ) n = n "\t"; \
  832. X        if ( length(n) < 16 ) n = n "\t"; \
  833. X        if ( length(n) < 24 ) n = n "\t"; \
  834. X        printf "%s\t%s\n", n, $2 }' v=$f $f/Index  >> I
  835. X    end
  836. X    sort -f I > Index
  837. X    rm I
  838. X    exit
  839. X    case PrintArchiveIndexes:
  840. X    cp /dev/null ~/tmp/netls
  841. X    foreach f ( ${LIST} )
  842. X        ls -RC $f >> /tmp/netls
  843. X    end
  844. X    cd /tmp
  845. X    print netls
  846. X    exit
  847. X    default:
  848. Xendsw
  849. END_OF_FILE
  850. if test 1261 -ne `wc -c <'MakeArchiveIndex.csh'`; then
  851.     echo shar: \"'MakeArchiveIndex.csh'\" unpacked with wrong size!
  852. fi
  853. chmod +x 'MakeArchiveIndex.csh'
  854. # end of 'MakeArchiveIndex.csh'
  855. fi
  856. if test -f 'assemble.csh' -a "${1}" != "-c" ; then 
  857.   echo shar: Will not clobber existing file \"'assemble.csh'\"
  858. else
  859. echo shar: Extracting \"'assemble.csh'\" \(6382 characters\)
  860. sed "s/^X//" >'assemble.csh' <<'END_OF_FILE'
  861. X#!    /bin/csh    -f
  862. X
  863. X# Archive management scripts.  Use in conjunction with narc
  864. X
  865. X# Geoffrey Leach
  866. X# LatiCorp Inc.    
  867. X# {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  868. X
  869. X# assemble    Assemble a group of files into an archive directory
  870. X# archive    Put and archive directory in its place
  871. X# retrieve    Get an archive directory into the cwd
  872. X
  873. X# This shell script implements an archive management facility.  The
  874. X# idea is that you have a archive whose path is in the environment
  875. X# variable ARCHIVE.  The directories here are your archive.  
  876. X# Files in an archive directory are compressed tar files if they were
  877. X# put there by this archive.  If they were put there by narc, then they
  878. X# are plain text files, which you will assemble into compressed tar, depending
  879. X# on how they got there.  Moderated archives are handled in a way that 
  880. X# lets you refer to a series of postings with shorthand.  BTW, moderated
  881. X# groups are assumed to be organized by volume in your archive.  Retrieve
  882. X# just helps you get a particular archive file into your cwd.
  883. X
  884. X# Usage - options apply as stated in the usage messages
  885. X#
  886. X#    -a    Specify ARCDIR.  Forces ARCVOL to ""
  887. X#    -e    Extract.  Overrides shorthand for moderated groups
  888. X#    -n    Specify archive file.  $1 defaults
  889. X#    -s    "Short" assemble; just get the files
  890. X#    -v    Specify ARCVOL
  891. X
  892. X
  893. X# Environment variable usage 
  894. X
  895. X#    ARCHIVE    base directory of archive
  896. X#    ARCPATH    directory name
  897. X#    ARCVOL    subdirectory name for moderated groups
  898. X
  899. X# Commands that are used by this script that you might not have
  900. X
  901. X#    unshar
  902. X
  903. Xset MYNAME   = $0
  904. Xset MYNAME   = $MYNAME:t
  905. X
  906. X# usage
  907. Xif ( $#argv == 0 ) then
  908. X    echo -n "Usage: $MYNAME [-a archive [-v volume]] "
  909. X    switch ( $MYNAME )
  910. X    case "assemble":
  911. X        echo "[-s] [-e name] [-n archive-name] base-issue [number-of-issues]"
  912. X        exit
  913. X    case "archive":
  914. X        echo "file"
  915. X        exit
  916. X    case "retrieve":
  917. X        echo "file"
  918. X        exit
  919. X    default:
  920. X        echo ""
  921. X        exit
  922. X    endsw
  923. Xendif
  924. X
  925. X# Check for environment usage
  926. Xif ( ! $?ARCHIVE ) set ARCHIVE
  927. Xif ( ! $?ARCDIR )  set ARCDIR
  928. Xif ( ! $?ARCVOL )  set ARCVOL
  929. X
  930. X# Check for switches
  931. Xset SWSCAN
  932. Xwhile ( $?SWSCAN )
  933. X    switch ( $1 )
  934. X    case -a:
  935. X        set ARCDIR = $2
  936. X    set ARCVOL = ""
  937. X    shift
  938. X    shift
  939. X    breaksw
  940. X    case -e:
  941. X    if ( ! $?EXTRACT ) then 
  942. X        set EXTRACT
  943. X    else
  944. X        unset EXTRACT
  945. X    endif
  946. X    shift
  947. X    breaksw
  948. X    case -n:
  949. X    set ARCFILE = $2
  950. X    shift
  951. X    shift
  952. X    breaksw
  953. X    case -s:
  954. X    set SHORT
  955. X    shift
  956. X    breaksw
  957. X    case -v:
  958. X    if ( $2 <= 9 ) then 
  959. X        set ARCVOL = v0$2
  960. X    else
  961. X        set ARCVOL = v$2
  962. X    endif
  963. X    shift
  964. X    shift
  965. X    breaksw
  966. X    case -*:
  967. X    echo "Unrecognized option $1"
  968. X    exit
  969. X    default:
  970. X    unset SWSCAN
  971. X    breaksw
  972. X    endsw
  973. Xend
  974. X
  975. Xif ( $ARCDIR == "" ) then
  976. X    echo -n "Archive directory? "
  977. X    set ARCDIR = $<
  978. Xendif
  979. X
  980. Xif ( $ARCVOL == "" ) then
  981. X    switch ( $ARCDIR )
  982. X    case x:
  983. X    case unix:
  984. X    case misc:
  985. X    case games:
  986. X        echo -n "Archive volume? "
  987. X        set ARCVOL = $<
  988. X        if ( $ARCVOL <= 9 ) then
  989. X        set ARCVOL = v0$ARCVOL
  990. X        else
  991. X        set ARCVOL = v$ARCVOL
  992. X        endif
  993. X        breaksw
  994. X    default:
  995. X        breaksw
  996. X    endsw
  997. Xendif
  998. Xset PREFIX = ${ARCVOL}i
  999. X
  1000. Xif ( $ARCVOL == "" ) then
  1001. X    set ARCPATH = $ARCHIVE/$ARCDIR
  1002. Xelse
  1003. X    set ARCPATH = $ARCHIVE/$ARCDIR/$ARCVOL
  1004. Xendif
  1005. X
  1006. X# Here is where we do the real work
  1007. Xswitch ( $MYNAME )
  1008. X    case assemble:
  1009. X
  1010. X    # For moderated groups, we usually have the number of the first posting,
  1011. X    # and (optionally) the number of postings.  These
  1012. X    # are combined to give a sequence of file names.  Otherwise, we assume
  1013. X    # that the argument is the prefix of the file(s) to be retrieved.
  1014. X    # There may be more than one file with that name as prefix.
  1015. X    switch ( $ARCDIR )
  1016. X        case "x":
  1017. X        case "unix":
  1018. X        case "misc":
  1019. X        case "games":
  1020. X        if ( ! $?EXTRACT ) then
  1021. X            set MODERATED
  1022. X            set BASE = $1
  1023. X            if ( $#argv == 2 ) then
  1024. X            set COUNT = $2
  1025. X            else
  1026. X            set COUNT = 1
  1027. X            endif
  1028. X        endif
  1029. X        breaksw
  1030. X        default:
  1031. X        breaksw
  1032. X    endsw
  1033. X
  1034. X    # Set up the directory structure for the archive.
  1035. X    # Conditional so that we can assemble into an existing directory.
  1036. X    # ARCF        is where we put the raw input for later deletion
  1037. X    # FILES        is the lis of original files, for later deletion
  1038. X    # HDRS        contains the .hdr files produced by unshar, so you can
  1039. X    #        find our later where all of this came from.
  1040. X    # PATCHES    is where you accumulate patch files.  I save these
  1041. X    #        so they can be un-applied later.  Useful if you are
  1042. X    #        applying unofficial patches to a maintained source.
  1043. X    if ( ! $?ARCFILE ) then
  1044. X        if ( $?MODERATED ) then
  1045. X        echo -n "Archive name? "
  1046. X        set ARCFILE = $<
  1047. X        else
  1048. X        set ARCFILE = $1
  1049. X        endif
  1050. X    endif
  1051. X    if ( ! -d $ARCFILE ) mkdir $ARCFILE
  1052. X    cd $ARCFILE
  1053. X    if ( ! -d HDRS ) mkdir HDRS
  1054. X    if ( ! -d ARCF ) mkdir ARCF
  1055. X    if ( ! -d PATCHES ) mkdir PATCHES
  1056. X
  1057. X    if ( $?MODERATED ) then
  1058. X        while ( $COUNT )
  1059. X        if ( $BASE <  10 ) set BASE = 0$BASE
  1060. X        if ( $BASE < 100 ) set BASE = 0$BASE
  1061. X        set f = $ARCPATH/${PREFIX}${BASE}
  1062. X        if ( ! -e $f ) echo $f not found
  1063. X        chmod +w $f
  1064. X        cp $f .
  1065. X        echo $f >> FILES
  1066. X        unshar $f:t
  1067. X        mv $f:t ARCF
  1068. X        @ COUNT = $COUNT - 1
  1069. X        @ BASE = $BASE + 1
  1070. X        end
  1071. X    else
  1072. X        foreach f ( $ARCPATH/$1* )
  1073. X        chmod +w $f
  1074. X        cp $f .
  1075. X        echo $f >> FILES
  1076. X        # You may want to assemble pre-existing archives.  We handle
  1077. X        # Compressed files, which may also be tar or shar.
  1078. X        set f = $f:t
  1079. X        if ( $f:e == "Z" ) then
  1080. X            set f = $f:r
  1081. X            uncompress $f
  1082. X        endif
  1083. X        if ( $f:e == "tar" ) then
  1084. X            tar xvf $f
  1085. X            set f = $f:r
  1086. X        else
  1087. X            unshar $f:t
  1088. X        endif
  1089. X        mv $f:t ARCF
  1090. X        end
  1091. X    endif
  1092. X    mv *hdr HDRS
  1093. X
  1094. X    if ( -e ark1isdone ) mv ark*isdone ARCF
  1095. X
  1096. X    if ( $?SHORT ) exit
  1097. X
  1098. X    # This maintains an archive of formatted documentation
  1099. X    roffit
  1100. X
  1101. X    CheckManifest
  1102. X    ls -C
  1103. X    exit
  1104. X
  1105. X    case archive:
  1106. X    if ( ! $?ARCFILE ) then
  1107. X        if ( $#argv != 1 ) then
  1108. X        echo -n "Archive name? "
  1109. X        set ARCFILE = $<
  1110. X        else
  1111. X        set ARCFILE = $1
  1112. X        endif
  1113. X    endif
  1114. X    if ( ! -d $ARCFILE ) then
  1115. X        echo archive: $ARCFILE not found
  1116. X        exit
  1117. X    endif
  1118. X    if ( -e $ARCFILE/FILES ) then
  1119. X        set F = ( `cat $ARCFILE/FILES` )
  1120. X        rm -r $ARCFILE/FILES
  1121. X    else
  1122. X        set F
  1123. X    endif
  1124. X    if ( ! -d $ARCPATH ) then
  1125. X        echo "$ARCPATH not found"
  1126. X        exit
  1127. X    endif
  1128. X    if ( -d $ARCFILE/ARCF ) rm -r $ARCFILE/ARCF
  1129. X    tar cvf $ARCPATH/$ARCFILE.tar $ARCFILE
  1130. X    if ( -e $ARCPATH/$ARCFILE.tar.Z ) rm -f $ARCPATH/$ARCFILE.tar.Z
  1131. X    compress $ARCPATH/$ARCFILE.tar
  1132. X    chmod -w $ARCPATH/$ARCFILE.tar.Z
  1133. X    rm -rf $ARCFILE $F
  1134. X    exit
  1135. X
  1136. X    case retrieve:
  1137. X    set f = $ARCPATH/$1.tar.Z
  1138. X    if ( ! -e $f ) then
  1139. X        echo $f not found
  1140. X        exit
  1141. X    endif
  1142. X    zcat $f | tar xvf -
  1143. X    exit
  1144. X    default:
  1145. X    exit
  1146. Xendsw
  1147. END_OF_FILE
  1148. if test 6382 -ne `wc -c <'assemble.csh'`; then
  1149.     echo shar: \"'assemble.csh'\" unpacked with wrong size!
  1150. fi
  1151. chmod +x 'assemble.csh'
  1152. # end of 'assemble.csh'
  1153. fi
  1154. if test -f 'makemap.csh' -a "${1}" != "-c" ; then 
  1155.   echo shar: Will not clobber existing file \"'makemap.csh'\"
  1156. else
  1157. echo shar: Extracting \"'makemap.csh'\" \(678 characters\)
  1158. sed "s/^X//" >'makemap.csh' <<'END_OF_FILE'
  1159. X#!    /bin/csh    -f
  1160. X
  1161. Xset BDIR    = /local/bin
  1162. Xset PDIR    = /local/lib/palias
  1163. Xset MAPDIR    = /local/lib/palias/uumap
  1164. Xset NEWSDIR    = /news/comp/mail/maps
  1165. Xset LOG        = $PDIR/makemap.log
  1166. X
  1167. Xset BASE = `cat $MAPDIR/.last`
  1168. Xcd $NEWSDIR
  1169. Xset MAPS = ( `ls` )
  1170. Xif ( $#MAPS == 0 ) exit
  1171. X
  1172. Xforeach m ( $MAPS )
  1173. X    if ( $m > $BASE ) then
  1174. X    $BDIR/unshar -n -c$MAPDIR $m >>& $LOG
  1175. X    set NEWMAP
  1176. X    endif
  1177. Xend
  1178. Xif ( ! $?NEWMAP ) exit
  1179. X
  1180. Xecho $m > $MAPDIR/.last
  1181. Xcd $PDIR
  1182. Xrm paths.pag paths.dir
  1183. Xmv paths paths.old
  1184. X$BDIR/pathalias Path.* uumap/[du].* | sed -e 's/    ptsfa\!/    /' -e '/^ptsfa/d'  | sort | $BDIR/pathprune > paths
  1185. X$BDIR/makedb -o paths paths
  1186. X#add sentinel for uumail >>& $LOG
  1187. X$BDIR/makedb -a -o paths @@@ >>& $LOG
  1188. END_OF_FILE
  1189. if test 678 -ne `wc -c <'makemap.csh'`; then
  1190.     echo shar: \"'makemap.csh'\" unpacked with wrong size!
  1191. fi
  1192. chmod +x 'makemap.csh'
  1193. # end of 'makemap.csh'
  1194. fi
  1195. if test -f 'roffit.csh' -a "${1}" != "-c" ; then 
  1196.   echo shar: Will not clobber existing file \"'roffit.csh'\"
  1197. else
  1198. echo shar: Extracting \"'roffit.csh'\" \(871 characters\)
  1199. sed "s/^X//" >'roffit.csh' <<'END_OF_FILE'
  1200. X#!    /bin/csh     -f
  1201. X# Find something that might be a man page and 'roff it.
  1202. X
  1203. X# Geoffrey Leach
  1204. X# LatiCorp Inc.    
  1205. X# {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  1206. X
  1207. Xset DIR = `pwd`
  1208. Xset DIR = $DIR:t
  1209. X
  1210. Xif ( $#argv == 0 ) then
  1211. X    set DOC = `find . \( -name "*.l" -o -name "*.man" -o -name "*.nro" -o -name "*.[1-8]" \) -print`
  1212. Xelse
  1213. X    set DOC = ( $* )
  1214. Xendif
  1215. Xforeach f ( $DOC )
  1216. X    if ( $f:h != "./ARCF" ) then
  1217. X    set D = $ARCHIVE/manl/$f:t 
  1218. X    if ( $f:t == README ) set $f = ${DIR}.$f
  1219. Xrepeat:
  1220. X    if ( -e $D ) then
  1221. X        echo -n "Man page $f exists.  Ignore(i), overwrite(o) or new name(n) [i]? "
  1222. X        set ans = $<
  1223. X        switch ( $ans )
  1224. X        case "i":
  1225. X        default:
  1226. X            continue
  1227. X        case "o":
  1228. X            breaksw
  1229. X        case "n":
  1230. X            echo -n "Enter new name: "
  1231. X            set ans = <$
  1232. X            set D = $ARCHIVE/manl/$ans
  1233. X            goto repeat
  1234. X            breaksw
  1235. X        endsw
  1236. X    endif
  1237. X    nroff -man $f > $D
  1238. X    endif
  1239. Xend
  1240. END_OF_FILE
  1241. if test 871 -ne `wc -c <'roffit.csh'`; then
  1242.     echo shar: \"'roffit.csh'\" unpacked with wrong size!
  1243. fi
  1244. chmod +x 'roffit.csh'
  1245. # end of 'roffit.csh'
  1246. fi
  1247. if test -f 'narc.c' -a "${1}" != "-c" ; then 
  1248.   echo shar: Will not clobber existing file \"'narc.c'\"
  1249. else
  1250. echo shar: Extracting \"'narc.c'\" \(11664 characters\)
  1251. sed "s/^X//" >'narc.c' <<'END_OF_FILE'
  1252. X/*
  1253. X**    Narc -- archive NetNews articles
  1254. X**
  1255. X**    Geoffrey Leach
  1256. X**    LatiCorp Inc.    
  1257. X**    {att,bellcore,sun,ames,pyramid}!pacbell!laticorp!geoff
  1258. X*/
  1259. X
  1260. X#include <stdio.h>
  1261. X#include <strings.h>
  1262. X#include <sys/file.h>
  1263. X#include "version.h"
  1264. X#include "patchlevel.h"
  1265. X
  1266. X#define    TRUE        1
  1267. X#define FALSE        0
  1268. X#define MATCH        0
  1269. X#define EXISTS        0
  1270. X#define PROMPT        0
  1271. X#define SUBJECT        1
  1272. X#define INDEX        2
  1273. X#define PNULL        (char *)0
  1274. X#define FNULL        (FILE *)0
  1275. X#define NGNULL        (sNewsGroup *)0
  1276. X#define INDEXR        "Indexr"
  1277. X
  1278. Xtypedef struct
  1279. X{
  1280. X    char *    name;
  1281. X    char *    archive;
  1282. X    char *    volume_tag;
  1283. X    int        moderated;
  1284. X} sNewsGroup;
  1285. X
  1286. Xextern char *    fgets();
  1287. Xextern char *    malloc();
  1288. Xextern char *    getenv();
  1289. Xextern char *    strpbrk();
  1290. Xextern char *    optarg;
  1291. Xextern int    optind;
  1292. X
  1293. XsNewsGroup *    NewsGroups[100];
  1294. XsNewsGroup     prompted = {PNULL, PNULL, PNULL, FALSE};
  1295. XFILE *        rc;
  1296. XFILE *        tty;
  1297. XFILE *        out;
  1298. XFILE *        aindex;
  1299. Xchar         arcdir[1024];
  1300. Xchar         descr[1024];
  1301. Xchar         arc_dir[1024];
  1302. Xchar        line[1024];
  1303. Xchar        head_buf[10240];
  1304. Xchar *        head_buf_ptr = head_buf;
  1305. Xchar        tmp_file[] = {"Narc.XXXXXX"};
  1306. Xchar        arc_file[256];
  1307. Xchar        arc_name[256];
  1308. Xchar        p_archive[256];
  1309. Xint        debug = FALSE;
  1310. Xint        named = FALSE;
  1311. Xint        repost = FALSE;
  1312. Xint        selected = FALSE;
  1313. Xint        subjected = FALSE;
  1314. Xint        head_buf_lines = 0;
  1315. X
  1316. XsNewsGroup*
  1317. Xlookup(name)
  1318. X    char    *name;
  1319. X{
  1320. X    int      i = -1;
  1321. X
  1322. X    /*
  1323. X     *  A little surgery: get rid of the  leading "Newsgroups: "
  1324. X     *  and remove any secondary newsgroups
  1325. X     */
  1326. X    name += 12;
  1327. X    *(strpbrk(name, ",\n")) = '\0';
  1328. X
  1329. X    /*
  1330. X     *  See if this newsgroup was listed in the user's rc file
  1331. X     */
  1332. X    while ( NewsGroups[++i] )
  1333. X    {
  1334. X    if ( strcmp(name, NewsGroups[i]->name) == MATCH )
  1335. X        return NewsGroups[i];
  1336. X    }
  1337. X    return NGNULL;
  1338. X}
  1339. X
  1340. Xvoid
  1341. Xrename_article(tmp_file, name)
  1342. X    char *tmp_file;
  1343. X    char *name;
  1344. X{
  1345. X    char  ans[10];
  1346. X    char  rcmd[1024];
  1347. X
  1348. X    if ( access(name, R_OK) == EXISTS )
  1349. X    {
  1350. X    printf("%s exists! (a)ppend, (i)gnore or (r)eplace [r]? ", arc_file);
  1351. X    fflush(stdout);
  1352. X    fgets(ans, 10, tty);
  1353. X    switch ( ans[0] )
  1354. X    {
  1355. X        default:
  1356. X        case 'r':
  1357. X        break;
  1358. X        case 'a':
  1359. X        sprintf(rcmd, "cat %s >> %s", tmp_file, name);
  1360. X        if ( debug )
  1361. X            printf("%s\n", rcmd);
  1362. X        system(rcmd);
  1363. X        unlink(tmp_file);
  1364. X        return;
  1365. X        case 'i':
  1366. X        return;
  1367. X    }
  1368. X    }
  1369. X
  1370. X    if ( rename(tmp_file, name) )
  1371. X    {
  1372. X    sprintf(rcmd, "Unable to rename %s", name);
  1373. X    perror(rcmd);
  1374. X    exit(1);
  1375. X    }
  1376. X}
  1377. X
  1378. Xvoid
  1379. Xclose_article()
  1380. X{
  1381. X    /*
  1382. X     *  The beginning of an article, and not the first.
  1383. X     *  Therefore, we have an article open that must be closed.
  1384. X     */
  1385. X    named     = FALSE;
  1386. X    repost    = FALSE;
  1387. X    subjected = FALSE;
  1388. X    if ( strlen(arc_name) )
  1389. X    {
  1390. X    fputs(arc_name, aindex);
  1391. X    fputs(":  ",    aindex);
  1392. X    fputs(descr,    aindex);
  1393. X    }
  1394. X    fclose(out);
  1395. X
  1396. X    if ( selected )
  1397. X    {
  1398. X    rename_article(tmp_file, arc_file);
  1399. X    out = fopen(tmp_file,"w");
  1400. X    selected = FALSE;
  1401. X    }
  1402. X    else
  1403. X    rewind(out);
  1404. X}
  1405. X
  1406. Xvoid
  1407. Xchop(str)
  1408. X    char *    str;
  1409. X{
  1410. X    *(str +strlen(str) - 1) = '\0';
  1411. X}
  1412. X
  1413. Xvoid
  1414. Xfgets_buffer()
  1415. X{
  1416. X    if ( (head_buf_ptr + strlen(line)) >= (head_buf + sizeof(head_buf)) )
  1417. X    {
  1418. X    printf("Could not find newsgroup (or volume) within %d lines\n",
  1419. X           head_buf_lines);
  1420. X    exit(1);
  1421. X    }
  1422. X
  1423. X    fgets(line, sizeof(line), stdin);
  1424. X    strcpy(head_buf_ptr, line);
  1425. X    head_buf_ptr += strlen(line) + 1;
  1426. X    head_buf_lines++;
  1427. X}
  1428. X
  1429. Xchar *
  1430. Xfgets_unbuffer()
  1431. X{
  1432. X    if ( head_buf_lines )
  1433. X    {
  1434. X    strcpy(line, head_buf_ptr);
  1435. X    head_buf_ptr += strlen(line) + 1;
  1436. X    head_buf_lines--;
  1437. X    return line;
  1438. X    }
  1439. X    return fgets(line, sizeof(line), stdin);
  1440. X}
  1441. X
  1442. Xvoid
  1443. Xmain(argc, argv)
  1444. X    int         argc;
  1445. X    char    *argv[];
  1446. X{
  1447. X    int         i;
  1448. X    int         opt;
  1449. X    int          vol;
  1450. X    int          mode = INDEX;
  1451. X    int          name_fd = 0;
  1452. X    int         article_name = 0;
  1453. X    char *     cmd;
  1454. X    char *     name;
  1455. X    char *     subj;
  1456. X    sNewsGroup * NewsGroup;
  1457. X
  1458. X    while ( (opt = getopt(argc, argv, "a:px")) != EOF )
  1459. X    {
  1460. X    switch ( opt )
  1461. X    {
  1462. X        case 'a':
  1463. X        prompted.archive = optarg;
  1464. X        break;
  1465. X        case 'p':
  1466. X        mode = PROMPT;
  1467. X        break;
  1468. X        case 'x':
  1469. X        debug = TRUE;
  1470. X        break;
  1471. X        default:
  1472. X        fprintf(stderr, "Usage: narc [-px] [-a archive]\n");
  1473. X        fprintf(stderr, "       version %s level %d\n", VERSION, PATCHLEVEL);
  1474. X        exit(1);
  1475. X    }
  1476. X    }
  1477. X
  1478. X    /*
  1479. X     * Get the archive directory from the environment
  1480. X     */
  1481. X    strcpy(arcdir, getenv("ARCHIVE"));
  1482. X
  1483. X    /*
  1484. X     * Read the user's ~/.narc file (if he has one) for the 
  1485. X     * newsgroups to watch.  What we are looking for is 
  1486. X     * The base of the archive directory (full path) this is the
  1487. X     * prefix for the archive directory specified for each newsgroup.
  1488. X     * Then, tab separated fields as follows:
  1489. X     *        newsgroup:  what fillows Newsgroups: in the header.
  1490. X     *        archive:    the directory under arcdir.
  1491. X     *        volume_tag: the tag for the line that says what the volume is 
  1492. X     *            (moderated newsgroups only).
  1493. X     *        moderated:  is this a moderated newsgroup? (0/1)
  1494. X     */
  1495. X    sprintf(line, "%s/.narcrc", getenv("HOME"));
  1496. X    if ( (rc = fopen(line, "r")) != FNULL )
  1497. X    {
  1498. X    i = 0;
  1499. X    while ( fgets(line, sizeof(line), rc ) != PNULL )
  1500. X    {
  1501. X        NewsGroup       =
  1502. X        NewsGroups[i++] = (sNewsGroup *)malloc(sizeof(sNewsGroup));
  1503. X
  1504. X        *(name = index(line, ':')) = '\0';
  1505. X        NewsGroup->name = malloc(strlen(line) + 1);
  1506. X        strcpy(NewsGroup->name, line);
  1507. X
  1508. X        subj = ++name;
  1509. X        if ( (name = index(subj, ':')) == PNULL )
  1510. X        {
  1511. X        NewsGroup->moderated = FALSE;
  1512. X        subj[strlen(subj) - 1] = '\0';
  1513. X        }
  1514. X        else
  1515. X        {
  1516. X        NewsGroup->moderated = TRUE;
  1517. X        *name = '\0';
  1518. X        }
  1519. X        NewsGroup->archive = malloc(strlen(subj) + 1);
  1520. X        strcpy(NewsGroup->archive, subj);
  1521. X
  1522. X        if ( NewsGroup->moderated )
  1523. X        {
  1524. X        subj = ++name;
  1525. X        NewsGroup->volume_tag = malloc(strlen(subj));
  1526. X        strncpy(NewsGroup->volume_tag, subj, strlen(subj) - 1);
  1527. X        }
  1528. X
  1529. X        if ( debug )
  1530. X        printf("%s\t%s\t%s\t%d\n", NewsGroup->name,
  1531. X                       NewsGroup->archive,
  1532. X                       NewsGroup->volume_tag,
  1533. X                       NewsGroup->moderated);
  1534. X    }
  1535. X    fclose(rc);
  1536. X    }
  1537. X
  1538. X    if ( (tty = fopen("/dev/tty", "r")) == FNULL )
  1539. X    {
  1540. X    perror("Error opening tty");
  1541. X    exit(1);
  1542. X    };
  1543. X
  1544. X    /*
  1545. X     *  If the user has not forced an archive, find one.
  1546. X     *  As we will skip past the first subject line, we need
  1547. X     *  to buffer the head of the file.
  1548. X     */
  1549. X    if ( prompted.archive )
  1550. X    NewsGroup = &prompted;
  1551. X    else
  1552. X    {
  1553. X    /*
  1554. X     *  Look for the Newsgroups line in the header
  1555. X     */
  1556. X    do 
  1557. X    {
  1558. X        fgets_buffer();
  1559. X    }
  1560. X    while ( strncmp(line, "Newsgroups: ", 12) != MATCH );
  1561. X
  1562. X    /*
  1563. X     *  Is the newsgroup on the list?  Note that we only look
  1564. X     *  at the first newsgroup that's specified.  
  1565. X     */
  1566. X    if ( (NewsGroup = lookup(line)) == NGNULL )
  1567. X    {
  1568. X        printf("Archive directory for %s? ", line);
  1569. X        fflush(stdout);
  1570. X        fgets(p_archive, sizeof(p_archive), tty);
  1571. X        chop(p_archive);
  1572. X        prompted.archive = p_archive;
  1573. X        NewsGroup = &prompted;
  1574. X    }
  1575. X
  1576. X    /*
  1577. X     *  If we find that we have a moderated newsgroup, we assume
  1578. X     *  that somewhere there will be a line in the header that tells
  1579. X     *  us about the current volume and the archive name of the 
  1580. X     *  program that's in this article.
  1581. X     */
  1582. X    if ( NewsGroup->moderated )
  1583. X    {
  1584. X        if ( mode != PROMPT )
  1585. X        mode = SUBJECT;
  1586. X
  1587. X        do
  1588. X        {
  1589. X        fgets_buffer();
  1590. X        }
  1591. X        while ( strncmp(line, NewsGroup->volume_tag,
  1592. X                strlen(NewsGroup->volume_tag)) != MATCH );
  1593. X
  1594. X        vol = atoi(&line[strlen(NewsGroup->volume_tag) + 8 ]);
  1595. X    }
  1596. X    }
  1597. X
  1598. X    /*
  1599. X     *  Everything that we need to know about output is determined.
  1600. X     */
  1601. X    if ( NewsGroup->moderated )
  1602. X    sprintf(arc_dir, "%s/%s/v%02d", arcdir, NewsGroup->archive, vol);
  1603. X    else
  1604. X    sprintf(arc_dir, "%s/%s", arcdir, NewsGroup->archive);
  1605. X
  1606. X    if ( debug )
  1607. X    {
  1608. X    printf("Archive directory selected is: %s\n", arc_dir);
  1609. X    strcpy(arc_dir, ".");
  1610. X    }
  1611. X    else
  1612. X    {
  1613. X    if ( chdir(arc_dir) )
  1614. X    {
  1615. X        sprintf(arc_file, "Could not chdir to %s", arc_dir);
  1616. X        perror(arc_file);
  1617. X        exit(1);
  1618. X    }
  1619. X    }
  1620. X
  1621. X    /*
  1622. X     *  The tmp file is created in the archive directory
  1623. X     */
  1624. X    mktemp(tmp_file);
  1625. X    if ( (out = fopen(tmp_file,"w")) == FNULL )
  1626. X    {
  1627. X    sprintf(arc_file, "Error opening %s" , tmp_file);
  1628. X    perror(arc_file);
  1629. X    exit(1);
  1630. X    };
  1631. X
  1632. X    /*
  1633. X     *  This is the "scratch" index that gets the raw data from
  1634. X     *  each article subject.  The user will extract one line for
  1635. X     *  each submission for the "real" index.
  1636. X     */
  1637. X    if ( (aindex = fopen(INDEXR, "a")) == FNULL )
  1638. X    {
  1639. X    perror("Error opening index");
  1640. X    exit(1);
  1641. X    };
  1642. X
  1643. X    /*
  1644. X     *  If we are not moderated and the user has not requested us
  1645. X     *  to prompt for names, then we need to generate a name.  No
  1646. X     *  advance preparation is required for this; if the .names file
  1647. X     *  does not exist, we will start naming at 000.
  1648. X     */
  1649. X    if ( !NewsGroup -> moderated && mode != PROMPT )
  1650. X    {
  1651. X    if ( (name_fd = open(".names", O_RDWR | O_CREAT, 0666)) == NULL )
  1652. X    {
  1653. X        perror("Error opening .names");
  1654. X        exit(1);
  1655. X    }
  1656. X
  1657. X    read(name_fd, &article_name, sizeof(int));
  1658. X    lseek(name_fd, 0L, L_SET);
  1659. X    }
  1660. X
  1661. X    /*
  1662. X     *  Now that we have somewhere to put the input, restart the input and
  1663. X     *  skip the first line which is (we hope) Path: ..
  1664. X     */
  1665. X    head_buf_ptr = head_buf;
  1666. X    fgets_unbuffer(line);
  1667. X    fputs(line, out);
  1668. X
  1669. X    /*
  1670. X     *  Process stdin until EOF.  We expect to have a sequence of net news
  1671. X     *  articles, each of which has a subject line.
  1672. X     */
  1673. X    while ( fgets_unbuffer() != PNULL )
  1674. X    {
  1675. X    if ( strncmp(line, "Path: ", 6) == MATCH )
  1676. X        close_article();
  1677. X
  1678. X    /*
  1679. X     *  Now that we have the new file (if that's what happened),
  1680. X     *  dispose of the current line
  1681. X     */
  1682. X    fputs(line, out);
  1683. X
  1684. X    /*
  1685. X     *  Does this line define the archive name?
  1686. X     */
  1687. X    if ( !named && (strncmp(line, "Archive-name: ", 13) == MATCH) )
  1688. X    {
  1689. X        /*
  1690. X         *  Process only one archive name per article
  1691. X         */
  1692. X        named = TRUE;
  1693. X
  1694. X        strcpy(arc_name, &line[14]);
  1695. X        *(strpbrk(arc_name, "/ \n")) = '\0';
  1696. X    }
  1697. X
  1698. X    /*
  1699. X     *  Do we have a Subject?
  1700. X     */
  1701. X    if ( !subjected && (strncmp(line, "Subject: ", 9) == MATCH) )
  1702. X    {
  1703. X        /*
  1704. X         *  Process only one Subject: per article
  1705. X         */
  1706. X        selected  = TRUE;
  1707. X        subjected = TRUE;
  1708. X
  1709. X        /*
  1710. X         *  Generate a name, using the subject line is possible
  1711. X         */
  1712. X
  1713. X        /*
  1714. X         *  First, drop the "Subject: "
  1715. X         */
  1716. X        subj = &line[9];
  1717. X
  1718. X        /*
  1719. X         *  Then, if this is a re-posting note the fact so that we
  1720. X         *  don't hassle the user if the first posting happens to
  1721. X         *  be in the archive and skip the "REPOST "
  1722. X         */
  1723. X        if ( strncmp(subj, "REPOST ", 7) == MATCH )
  1724. X        {
  1725. X        subj += 7;
  1726. X        repost = TRUE;
  1727. X        }
  1728. X
  1729. X        /*
  1730. X         *  How we generate the name depends on what kind of newsgroup
  1731. X         */
  1732. X        switch ( mode )
  1733. X        {
  1734. X        case SUBJECT:        /* moderated groups */
  1735. X            /*
  1736. X             *  Tell the user what's happening
  1737. X             */
  1738. X            printf("%s", subj);
  1739. X
  1740. X            /*
  1741. X             *  Name should begin with something like v02i023:
  1742. X             *  Assume this, and use the fist 7 characters for
  1743. X             *  the file name
  1744. X             */
  1745. X            strncpy(arc_file, subj, 7);
  1746. X            break;
  1747. X        case PROMPT:        /* user wants us to prompt for name */
  1748. X            /*
  1749. X             *  This is the article
  1750. X             */
  1751. X            printf("%s", subj);
  1752. X            fputs("Output file? ", stdout);
  1753. X            fflush(stdout);
  1754. X            fgets(arc_name, sizeof(arc_name), tty);
  1755. X            chop(arc_name);
  1756. X            if ( strlen(arc_name) == 0 )
  1757. X            {
  1758. X            /*
  1759. X             *  User declines to save this item
  1760. X             */
  1761. X            selected = FALSE;
  1762. X            continue;
  1763. X            }
  1764. X            strcpy(arc_file, arc_name);
  1765. X            break;
  1766. X        case INDEX:        /* generate name */
  1767. X            sprintf(arc_file, "%03d", article_name++);
  1768. X            strcpy(arc_name, arc_file);
  1769. X            /*
  1770. X             *  Tell the user what we did
  1771. X             */
  1772. X            printf("%s: %s", arc_file, subj);
  1773. X            break;
  1774. X        default:
  1775. X            break;
  1776. X        }
  1777. X        strcpy(descr, subj);
  1778. X    }
  1779. X    }
  1780. X
  1781. X    close_article();
  1782. X    unlink(tmp_file);
  1783. X
  1784. X    if ( name_fd )
  1785. X    {
  1786. X    write(name_fd, &article_name, sizeof(int));
  1787. X    close(name_fd);
  1788. X    }
  1789. X}
  1790. END_OF_FILE
  1791. if test 11664 -ne `wc -c <'narc.c'`; then
  1792.     echo shar: \"'narc.c'\" unpacked with wrong size!
  1793. fi
  1794. # end of 'narc.c'
  1795. fi
  1796. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  1797.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  1798. else
  1799. echo shar: Extracting \"'patchlevel.h'\" \(21 characters\)
  1800. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  1801. X#define PATCHLEVEL 0
  1802. END_OF_FILE
  1803. if test 21 -ne `wc -c <'patchlevel.h'`; then
  1804.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  1805. fi
  1806. # end of 'patchlevel.h'
  1807. fi
  1808. if test -f 'version.h' -a "${1}" != "-c" ; then 
  1809.   echo shar: Will not clobber existing file \"'version.h'\"
  1810. else
  1811. echo shar: Extracting \"'version.h'\" \(22 characters\)
  1812. sed "s/^X//" >'version.h' <<'END_OF_FILE'
  1813. X#define VERSION "1.0"
  1814. END_OF_FILE
  1815. if test 22 -ne `wc -c <'version.h'`; then
  1816.     echo shar: \"'version.h'\" unpacked with wrong size!
  1817. fi
  1818. # end of 'version.h'
  1819. fi
  1820. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  1821.   echo shar: Will not clobber existing file \"'Makefile'\"
  1822. else
  1823. echo shar: Extracting \"'Makefile'\" \(117 characters\)
  1824. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  1825. Xnarc:    narc.o
  1826. X    cc -O -o narc narc.c
  1827. X
  1828. Xclean:
  1829. X    -rm core *.o narc
  1830. X
  1831. Xnarc.o:    narc.c
  1832. Xnarc.o:    version.h
  1833. Xnarc.o:    patchlevel.h
  1834. END_OF_FILE
  1835. if test 117 -ne `wc -c <'Makefile'`; then
  1836.     echo shar: \"'Makefile'\" unpacked with wrong size!
  1837. fi
  1838. # end of 'Makefile'
  1839. fi
  1840. echo shar: End of shell archive.
  1841. exit 0
  1842.  
  1843.  
  1844.